7 EECE 4353 Image Processing Vanderbilt University School of Engineering
EECE/CS 4353 Image Processing
Lecture Notes: Color Correction
Richard Alan Peters II Department of Electrical and Computer Engineering Fall Semester 2021 Co This work is licensed under the Creative Commons Attribution-Noncommercial 2.5 Lic To view a copy of this lic isit http://creativecommons.org/licenses/by-ne/2.5/ or
end a letter to Cre ative Commons, 543 Howard Stre seals r, San Fra: 0, Ca lifornia, 94105, USA.
EECE 4353 Image Processing Vanderbilt University School of Engineering Color Correction
is a global change in the coloration of an image to alter its tint, its hues, or the saturation of its colors with minimal changes to its luminant features.
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 2
7 EECE 4353 Image Processing
Vanderbilt University School of Engineering
Gamma Adjustment of Color Bands original
10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
David Peters, producer, and representatives of the IA, The International Alliance of Theatrical Stage Employees, Moving Picture Technicians, Artists and Allied Crafts, on the set of Frozen Impact (PorchLight Entertainment, 2003).
27 September 2021 ) 1999-2021 by Richard Alan Peters II 3
EECE 4353 Image Processing Vanderbilt University School of Engineering Gamma Adjustment of Color Bands red y=2
10000 9000 8000
7000
6000
5000
4000
2000
2000
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 4
7 EECE 4353 Image Processing
Vanderbilt University School of Engineering
Gamma Adjustment of Color Bands original
10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
David Peters, producer, and representatives of the IA, The International Alliance of Theatrical Stage Employees, Moving Picture Technicians, Artists and Allied Crafts, on the set of Frozen Impact (PorchLight Entertainment, 2003).
27 September 2021 ) 1999-2021 by Richard Alan Peters II 5
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Gamma Adjustment of Color Bands _ red y=0.5
Al | fi
CEC ETEECET
reduced red = increased cyan
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 6
7 EECE 4353 Image Processing
Vanderbilt University School of Engineering
Gamma Adjustment of Color Bands original
10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
David Peters, producer, and representatives of the IA, The International Alliance of Theatrical Stage Employees, Moving Picture Technicians, Artists and Allied Crafts, on the set of Frozen Impact (PorchLight Entertainment, 2003).
27 September 2021 ) 1999-2021 by Richard Alan Peters II 7
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 8
7 EECE 4353 Image Processing
Vanderbilt University School of Engineering
Gamma Adjustment of Color Bands original
10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
David Peters, producer, and representatives of the IA, The International Alliance of Theatrical Stage Employees, Moving Picture Technicians, Artists and Allied Crafts, on the set of Frozen Impact (PorchLight Entertainment, 2003).
27 September 2021 ) 1999-2021 by Richard Alan Peters II 9
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Gamma Adjustment of Color Bands green y=0.5
i” : |
i val:
reduced green = incr. magenta
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 10
EECE 4353 Image Processing Vanderbilt University School of Engineering
Gamma Adjustment of Color Bands original
10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
David Peters, producer, and representatives of the IA, The International Alliance of Theatrical Stage Employees, Moving Picture Technicians, Artists and Allied Crafts, on the set of Frozen Impact (PorchLight Entertainment, 2003).
27 September 2021
€e) 1999-2021 by Richard Alan Peters II 11
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 12
EECE 4353 Image Processing Vanderbilt University School of Engineering
Gamma Adjustment of Color Bands original
10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
David Peters, producer, and representatives of the IA, The International Alliance of Theatrical Stage Employees, Moving Picture Technicians, Artists and Allied Crafts, on the set of Frozen Impact (PorchLight Entertainment, 2003).
27 September 2021
€) 1999-2021 by Richard Alan Peters II 13
7 EECE 4353 Image Processing Vanderbilt University School of Engineering Gamma Adjustment of Color Bands __ blue y=0.5
10000
|
is}
l
oh |
reduced blue = incr. yellow
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 14
EECE 4353 Image Processing Vanderbilt University School of Engineering
Gamma Adjustment of Color Bands original
10000
9000
8000
7000
6000
5000
4000
3000
2000
1000
David Peters, producer, and representatives of the IA, The International Alliance of Theatrical Stage Employees, Moving Picture Technicians, Artists and Allied Crafts, on the set of Frozen Impact (PorchLight Entertainment, 2003).
27 September 2021
€) 1999-2021 by Richard Alan Peters II 15
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
RGB to LHS: A Perceptual Transformation
The eye has 3 types of photoreceptors: sensitive to red, green, or blue light.
= See . “ = ——- if < -
SOUBUIWIN|
—_ — —
\,8 IT | Ni A Vf WN
\\Se rH)
—
ony
uoleinjes
The brain transforms RGB into separate brightness and color channels (e.g., LHS).
brain photo receptors
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 16
Vanderbilt University School of Engineering
EECE 4353 Image Processing
HSV Color Representation
. Vo =$(%) + 0 +b))(? +8 +b)
R
+ marks the S$) =Po- Vo spot where R=-G=B= Color vector po (rotQotbo)/3 ry Yo Yo & Sg aes win Po = (ro, Jo, Bo) b, Triangle: lle B : B n=l] W, lies in plane R+G+B=(ro+go+bo), sy =|s,|
intersects R, G, & B axes at rotgotbo, and contains po. mes (% + Sot bo) al Vo] ; 5, |
27 September 2021 €) 1999-2021 by Richard Alan Peters II 17
7 | This algorithm is based EECE 4353 Image Processing on the hex projection. Vanderbilt University School of Engineering
A Fast RGB to HSV Algorithm
Given color p = [R G B]' where R, G, B €{0,...,255!, to compute [h s v]' where s, v €[0,1] and h <€[0,360) the algorithm proceeds as follows: . Compute [r g b] = [R G B]/255. R,G,B are
, Seb mM =-min(+,g,b) , M = max (r,;g,b).« numbers here _ Set v = M. not images.
‘ = C/M.
. If M==r then h = ((g-b)/c) modulo 6. . else if M==g then h = 2 + (b-r)/c.
. else h = 4 + (r-g)/c.
O.h = 60h.
Experiments with Matlab show this algorithm to be 3 times faster than Algorithm 1 and 1.13 faster than Algorithm 2 (EECE_4353_06 RGBandHSVColor). The numbers output by this one differ from the other two.
Reference: HSL and HSV - Wikipedia, the free encyclopedia
27 September 2021 €€) 1999-2021 by Richard Alan Peters II
—" —_ —_ oe)
7 EECE 4353 Image Processing Vanderbilt University School of Engineering | The x, y, & z unit vectors inr, g, |
. & b coordinates are the column HSV to RGB Conversion | of the sree 7 |
Therefore, the rotation matrix is . 2 oO v2 4-2 -1 V3 v2]. -1 -V3 V2 r
Substitute that into the 24 equation on slide 94 to get:
[sly = sEcos( | sPsin(H) + off
-l -l
s%cos(h) | s2sin(h) }
-1
Finally, [S],o, must be translated to the value vector to obtain the rgb color of po:
Po =[P] v=[8] ent LV] ep » Where So = [Slrep and [V],g,= Vo as def’d. on slide 81.
27 September 2021 €) 1999-2021 by Richard Alan Peters II 19
7 This algorithm is the inverse EECE 4353 Image Processing of the hex projection. Vanderbilt University School of Engineering
A Fast HSV to RGB Algorithm
Given vector h!'=[/s v] where h « [0, 360), s € [0, 1], and v ¢€ [0, 1], to compute p! = [r gb] where r, g,b € {0,..., 255}:
h,s,&vare numbers here not images.
= | mod. 2) —L')). .
Qs 4H then
1<H then
2S H then
35 H then
4<H then
5 < H 6 then
g.b) = 10. 0 0]
= goo* [|rFD g+D
Reference: HSL and HSV - Wikipedia, the free encyclopedia 27 September 2021 &) 1999-2021 by Richard Alan Peters II a1 20
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Saturation Adjustment original
Original Dave & IA Image
10000 | 9000 | gooo | 7000 | 6000 |
5000 |
4000 |-
3000 + h 2000 |r
1000” ¢ J
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 21
7 EECE 4353 Image Processing Vanderbilt University School of Engineering Saturation Adjustment saturation + 50%
10000
9000 }|-
8000 }
7000 };
6000 };
5000 }
4000 };
3000 };
2000 |-
1000}
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 22
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Saturation Adjustment original
Original Dave & IA Image
40000 F 9000 | sooo} 7000 | 6000 | 5000 |
4000 }+-
3000}
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 23
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Saturation Adjustment saturation - 50%
9000 F
8000 }-
7000 |-
6000}
5000 |-
4000 |-
3000 +
2000 +
1000+ f
27 September 2021 €) 1999-2021 by Richard Alan Peters II 24
original
Original Dave & IA Image
27 September 2021 &e) 1999-2021 by Richard Alan Peters I
7 EECE 4353 Image Processing
Vanderbilt University School of Engineering
hue + 60°
10000 |}
9000 |+-
8000 }|-
7000 |
6000 +
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 26
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Hue Shifting hue + 120°
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 27
hue + 180°
9000 |-
8000
7000 |-
6000}
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 28
hue + 240°
10000 |+-
9000 |
8000 +
7000 }-
6000 |+-
5000 |+-
4000 |-
3000 | } 2000 [
f 1000; "|?
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 29
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 30
hue + 360° = original
Original Dave & IA Image
10000
9000 |-
8000 +
7000 }-
6000 +
5000 |
4000 |-
3000 + 2000 |r
1000} * |
27 September 2021 €e) 1999-2021 by Richard Alan Peters II a]
original
1 1
G C B M R
The effect of a hue shift on the hue histogram is quite obvious...
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 32
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
hue + 60°
Hue + 60°
T T T
aol HU
M R
.. the entire histogram is shifting...
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 33
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
hue + 120°
Hue + 120°
T T T T
. and the shift is circular since the hue is a circular function - it is defined ona circle.
R
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 34
EECE 4353 Image Processing Vanderbilt University School of Engineering
hue + 180°
Hue + 180° T T T T 2.0], 4 1.51] 4 1.0| 0.5 4 1 [ | | thy 1 vals le tten A J R Y. G C B M R
The part of the histogram that leaves one side appears on the other.
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 30
hue + 240°
Hue + 240°
T T T
0.5
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 36
hue + 300°
Hue + 300°
T T T
0.5
a
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 31
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 38
AXA EECE 4353 Image Processing
Linear Transformation of Color Vanderbilt University School of Engineering
EECE 4353 Image Processing Vanderbilt University School of Engineering Color Correction via Linear Transformation
is a point process; the transformation 1s applied to each pixel as a function of its color alone.
J(r,c) =| I(r,c) |, V(r,c) esupp(I).
Each pixel is vector valued, therefore the transformation is a vector space operator.
R, (7,c) R, (r,c) R, (7,c) I(r,c) = G,(r,c) ; J(r,c) = G,(r,c) =®{I(r,c)} =® G,(r,c B,(r,c) B,(r.c) B, (7,¢)
27 September 2021 €) 1999-2021 by Richard Alan Peters II 40
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Vector Space Operators
Linear operators Ai) Wit, iy, Gig. | 2
are matrix S.\=|ay. Gy Gs || S
multiplications b| la, ay ay, || b (r, / 255)”
Ml ; Example of a
g, |= 255-|(g, / 255)" nonlinear operator:
b, (b, (255)! gamma correction
27 September 2021 €) 1999-2021 by Richard Alan Peters II 4]
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 42
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 43
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 44
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 45
7 EECE 4353 Image Processing Vanderbilt University School of Engineering Color Transformation
Assume J is a discolored version of image I such that J = O[ I]. If Dis linear then it is represented by a 3x3 matrix, A:
Ga, GU, Ay A=|@, GQ) 4); |.
G3; Gz, 33
Then J = AI or, more accurately, J(r,c) = Al(r,c) for all pixel locations (r,c) inimage I. I(r,c) € Z.
27 September 2021 €) 1999-2021 by Richard Alan Peters II 46
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
° Each color in th tout t Color Transformation Siar areata arcy aa ar
colors in the input vector.
If at pixel location @ c) : then J (2 c) = Al(r, c) , or Pi Py GA, A. 43 || PI Hide’ I(r, c) =|7, | and Ys |=] 41 422 3 | M1 B B, a, Ay ay || B, Py AP + Ay + AP, image J(r, c) =| 7, |; =|4Py + AnYy + Af, |. B, Ay Py + Ant, + apf,
27 September 2021 €) 1999-2021 by Richard Alan Peters II 47
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Transformation
The inverse transform ®"! (if it exists) maps the discolored
image, J, back into the correctly colored version, I, i.e., I=@"[ J]. If @ is linear then it is represented by the
inverse of matrix A:
= = __ —_ -1 AU = aes A 473439 — AyQy 433 + A“ may or | may not exist.
si Ay A4303) 1 A)34, Az. — Ae :
A733 A4305y A339 A943, Ay 43— A 3449
343;— G4 1433 A, 1433— A), 343, A304, 4145,
Ay 1439 A943, Ay G3)7 G45 Ag Ay Ga,
48
27 September 2021 €) 1999-2021 by Richard Alan Peters II
EECE 4353 Image Processing
Vanderbilt University School of Engineering
Color Correction
Assume we know n colors in the discolored image, J, that
correspond to another set of n colors (that we also know) in the original image, I.
nN
nN
PY, PL PA, k V 3k Vig |S is YIk
Py x Pr, Pyr |), Pur l|._,
for A =1,...,7n.
known known wrong known correct colors correspondence colors
27 September 2021
&e) 1999-2021 by Richard Alan Peters II
49
7 EECE 4353 Image Processing Vanderbilt University School of Engineering Color Correction
To remap the discolored image so that the result matches the original image 1n a linearly optimal way, we need to find the matrix, A, that minimizes
2 PI. k PJ k
b
BE = Ll Vue -AT VI,k
9
Bi k Py x
b
27 September 2021 €) 1999-2021 by Richard Alan Peters II 50
7 EECE 4353 Image Processing Vanderbilt University School of Engineering Color Correction
To find the solution of this problem, let
Pri Pan Py Py.n Y= ra || 7x | \s and X= Fagg |r Ta By Bn By, Pes
Then X and Y are known 3xn matrices such that YrA'X,
where A is the 3x3 matrix that we want to find.
27 September 2021 €) 1999-2021 by Richard Alan Peters II |
EECE 4353 Image Processing
¥] Vanderbilt University School of Engineering
Color Correction
The linearly optimal solution is the least mean squared
solution that is given by —] T T\ B=A'=YX'(Xx"]
where X |. represents the transpose of matrix X,,,,,.
Notes: 1. a, the number of color pairs, must be = 3, 2. [XX!'],., must be invertible, i.e., rank(XX') = 3, 3. Ifn=3, then X'(XX!)!=X-1. — important 52
27 September 2021 €e) 1999-2021 by Richard Alan Peters II
A EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Correction
. : . Psi Pan [Ps V5 Bal The linearly optimal soluti alld oa : ared solution that 1s given by tl Load [LOre Yor Poa!
B=A'=YX'(XX') output colors (wanted): Pui Pin igh |e"? || Ane Notes: l. an,t aa t pairs, must be = 3,
. [XX1"],., must be invertible, i.e., rank(XX!') = 3, 3. If n=3, then X'(XX')!=X7,
where X |, repr se of matrix X3,.,..
27 September 2021 €) 1999-2021 by Richard Alan Peters II 53
A EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Correction
The linearly optimal soluti solution that is given by
where X |. repr se of matrix X3,.,.. Notes: 1. n,t t pairs, must be = 3, 2. [XX"'],,, must be invertible, i.e., rank(XX!') = 3,
3. If n=3, then X'(XX')!=X7,
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 54
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Correction Then the image 1s color corrected by performing
I(r,c)=BJ(r,c), for all (r,c) esupp(J).
In MATLAB this is easily performed by
>> I = reshape(((B*(reshape(double(J),R*C,3))')'),R,C,3); >> m = min(I(:));
>> M = max(I(:));
>> I = uint8(255*(I-m)/(M-m));
where B=A'! is computed directly through the LMS formula on the previous page, and R & C are the number of rows and columns in the image.
27 September 2021 €) 1999-2021 by Richard Alan Peters II 55
A EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Correction
Then the image is color corrected bv performing The first reshape must be as R*C rows by 3 columns. Then it I (r, c) —-BJ (r, c) must be transposed to be premultiplied by B. If you
bs ., reshape it directly into a 3 by In MATLAB this 1s easil p*c matrix, it will not work.
>> I = reshape(((B*(reshape(double(J),R*C,3))')'),R,C,3); a 7 min(I(:)); After the matrix multiply is
>> M = max(I(:)); done, the result must be
>> I = uint8(255*(I-m)/(M- transposed again to R*C rows
by 3 columns. Then it can be where B=A°! is computed dir reshaped to R by C by 3. mula
on the previous page, and R & C are the number of rows and columns in the image.
27 September 2021 €) 1999-2021 by Richard Alan Peters II 56
EECE 4353 Image Processing
Vanderbilt University School of Engineering
Color Correction Then the image 1s color corrected by performing
I(r,c)=BJ(r,c), for all (r,c) esupp(J).
In MATLAB this is easily performed by
>> >> >> >>
ie Ee a
reshape (((B*(reshape(double(J),R*C,3))')'),R,C,3); main(l(:));
max(I(:)); uint8(255*(I-m)/(M-m));
Depending on the image, you
might get better results if you ted directly through the LMS formula airectly Conver T to HAIG nd R & Care the number of rows and rather than scaling it first. Try
both, and select the version
that looks best.
27 September 2021 €) 1999-2021 by Richard Alan Peters II ot
EECE 4353 Image Processing Vanderbilt University School of Engineering Linear Color Correction
NASA Summer Faculty Fellows at Ellington Air Force Base, Houston, TX, July 2002. Airplane is a T-38.
S53 FSES ERS
Original Image “Aged” Image
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 58
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Mapping 1
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 59
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Mapping 2
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 60
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Mapping 3
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 61
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Mapping 4
Original Image “Aged” Image
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 62
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Transformations
The aging process was a transformation, ®, that mapped:
le 17 222 222 240 240 236 240 122 |=®,/ 121 222 |=@D4| 222 171 }=@,| 171 227 |=®4| 230 114 171 185 218 103 160 106 166
27 September 2021 €) 1999-2021 by Richard Alan Peters II 63
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Color Transformations
7 EECE 4353 Image Processing Vanderbilt University School of Engineering
Correction Using 3 Mappings
222 17 240 222 17 240 X=] 222 122 171 Y=|222 121 171
185 114 103 218 171 160
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 65
EECE 4353 Image Processing Vanderbilt University School of Engineering Correction Using 3 Mappings B=A’=YX'
original corrected
222 17 240 222 17 240 X=] 222 122 171 Y=|222 121 171 185 114 103 218 171 160
27 September 2021 €e) 1999-2021 by Richard Alan Peters II 66
EECE 4353 Image Processing Vanderbilt University School of Engineering Another Correction Using 3 Mappings B=A’=YX'
$53 0885 £83
RI nwa a BSPa OA #53 FaRS ESE
222 17 236 222 17 240 X=] 222 122 227 Y=| 222 121 230 185 114 106 218 171 166
27 September 2021 €) 1999-2021 by Richard Alan Peters II 67
EECE 4353 Image Processing Vanderbilt University School of Engineering Another Correction Using 3 Mappings B=A’=YX'
original corrected
222 17 236 222 17 240 X=] 222 122 227 Y=| 222 121 230 185 114 106 218 171 166
27 September 2021 ) 1999-2021 by Richard Alan Peters II 68
EECE 4353 Image Processing Vanderbilt University School of Engineering Correction Using All 4 Mappings B=A'=YX"(XX")
RA mwa 4 BSRa OWA #53 EARS ERE Ries aww ia BNR OW S23 RAEN ERE
222 17 236 240 222 17 240 240 X=] 222 122 227 171 Y=| 222 121 230 171
185 114 106 103 218 171 166 160
27 September 2021 €) 1999-2021 by Richard Alan Peters II 69
EECE 4353 Image Processing Vanderbilt University School of Engineering Correction Using All 4 Mappings B= A‘ =YX"(XX")
original corrected
222 17 236 240 222 17 240 240 X=] 222 122 227 171 Y=| 222 121 230 171 185 114 106 103 218 171 166 160
27 September 2021 €) 1999-2021 by Richard Alan Peters II 70
EECE 4353 Image Processing
Vanderbilt University School of Engineering
Random Sampling of Color Values
>>
>>
>>
>>
>>
>>
>>
>>
>>
27 September 2021
Y(:,3) diag(I(rr,rc,3)); X(:,1) diag(J(rr,rc,1)); X(:,2) diag(J(rr,rc,2)); X(:,3) diag(J(rr,rc,3));
&e) 1999-2021 by Richard Alan Peters II
R = number of rows in image C = number of columns in image n = number of pixels to select
rand([1 nj): 1 x n matrix of random numbers between 0 and 1.
diag(I(rr,rc,1)): vector from main diagonal of matrix I(rr,rc,1).
71
EECE 4353 Image Processing
Vanderbilt University School of Engineering
ES Pas aww
a ora 0a BUS BES ERE
¢
583 W4E5 £83
72
27 September 2021
EECE 4353 Image Processing Vanderbilt University School of Engineering
Correction Using 128 Mappings B=A'=YX"(XX")
- Ia - a Wa OP OYA
fa ) S83 FBES ER
LIAL
27 September 2021 €) 1999-2021 by Richard Alan Peters II 73
EECE 4353 Image Processing Vanderbilt University School of Engineering Correction Using 128 Mappings B= A‘ =YX"(XX")
original corrected
for EECE 4353 Image Processing comparison: Vanderbilt University School of Engineering Correction Using 4 Mappings B= A‘ =YX"(XxX")
original corrected
222 17 236 240 222 17 240 240 X=] 222 122 227 171 Y=/222 121 230 171 185 114 106 103 218 171 166 160
27 September 2021 e) 1999-2021 by Richard Alan Peters II 75
Vanderbilt University School of Engineering
EECE 4353 Image Processing
MATLAB Linear Color Transformation Function
function J = LinTrans(I,B)
[R C D] = size(I); if D ~= 3
error(‘Image must have 3 bands'); end
I = double(I); j=
reshape (((B*(reshape(I,R*C,3))')'),R,C,3); end;
This function returns an image of class double. To get a good uint8 you may have to linearly scale the result as shown on slide 55. Or not.
27 September 2021 €) 1999-2021 by Richard Alan Peters II 76